@Configuration
public class RabbitConfig {
    public static final String DEFAULT_DIRECT_EXCHANGE = "DIRECT_EXCHANGE";
    public static final String MAIL_QUEUE = "MAIL";

    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange(DEFAULT_DIRECT_EXCHANGE);
    }

    @Bean
    public Queue mailQueue() {
        return new Queue(MAIL_QUEUE);
    }

    @Bean
    public Binding mailQueueBinding() {
        return BindingBuilder
                .bind(mailQueue())
                .to(directExchange())
                .withQueueName();
    }
}
